package com.openbravo.beans;

import java.text.MessageFormat;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class LocaleResources
{
  private List<ResourceBundle> m_resources = new LinkedList();

  public void addBundleName(String paramString)
  {
    this.m_resources.add(ResourceBundle.getBundle(paramString));
  }

  public String getString(String paramString)
  {
    if (paramString == null)
      return null;
    Iterator localIterator = this.m_resources.iterator();
    while (localIterator.hasNext())
    {
      ResourceBundle localResourceBundle = (ResourceBundle)localIterator.next();
      try
      {
        return localResourceBundle.getString(paramString);
      }
      catch (MissingResourceException localMissingResourceException)
      {
      }
    }
    return "** " + paramString + " **";
  }

  public String getString(String paramString, Object[] paramArrayOfObject)
  {
    if (paramString == null)
      return null;
    Object localObject1 = this.m_resources.iterator();
    Object localObject2;
    while (((Iterator)localObject1).hasNext())
    {
      localObject2 = (ResourceBundle)((Iterator)localObject1).next();
      try
      {
        return MessageFormat.format(((ResourceBundle)localObject2).getString(paramString), paramArrayOfObject);
      }
      catch (MissingResourceException localMissingResourceException)
      {
      }
    }
    localObject1 = new StringBuffer();
    ((StringBuffer)localObject1).append("** ");
    ((StringBuffer)localObject1).append(paramString);
    for (Object localObject3 : paramArrayOfObject)
    {
      ((StringBuffer)localObject1).append(" < ");
      ((StringBuffer)localObject1).append(localObject3.toString());
    }
    ((StringBuffer)localObject1).append("** ");
    return (String)(String)((StringBuffer)localObject1).toString();
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.beans.LocaleResources
 * JD-Core Version:    0.6.0
 */